package com.example.mapper;

import com.example.pojo.Indent;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ContractpayMapper {
    @Insert("insert into contractpay(name, area, room_type, price, image, mm, s_date, y, z_date, zfprice, tname, fname, id_u, id_a,id_f,fimage,znickname ,fnickname,tnumber, fnumber, fid_card, zid_card) values (#{name}, #{area},#{roomType}, #{price}, #{image}, #{mm}, #{sDate}, #{y}, #{zDate}, #{zfprice}, #{tname}, #{fname}, #{idU},#{idA}, #{idF},#{fimage}, #{znickname},#{fnickname},#{tnumber}, #{fnumber}, #{fidCard}, #{zidCard}) ")
    void addOrder(Indent indent);

    List<Indent> getPayment(LocalDateTime date, Integer idU);

    List<Indent> getPaymentF(LocalDateTime date, Integer idF);

    List<Indent> getContractZk(String fname, Integer idU);

    List<Indent> getContractFj(String name, LocalDateTime now, Integer idF);

    List<Indent> getContractFL(String name, LocalDateTime now, Integer idF);

    @Select("select * from contractpay where id=#{id} and id_u=#{idU}")
    Indent getContractIdZk(Integer id, Integer idU);

    @Select("select * from contractpay where id=#{id} and id_f=#{idF}")
    Indent getContractIdF(Integer id, Integer idF);

}
